const request = require("/util/request")

// 小程序用户登录
export function login(data) {
    return request({
        url: 'user/app/exchangeToken',
        method: 'POST',
        data: data
    })
}

// 人脸识别
export function authFace(data) {
    return request({
        url: 'user/app/authentication',
        method: 'POST', 
        data: data
    })
}
export function startAPVerify(data) {
    return new Promise((resolve,reject)=>{
        my.startAPVerify({
            url: data.url,
            certifyId: data.certifyId,
            success: function (res) {
                if (res.resultStatus == 9000) {
                    resolve(res)
                } else {
                    reject(res)
                }
            }
        })
    })
}

// 身份信息保存(人脸识别成功调用)
export function authSave(data) {
    return request({
        url: 'user/app/save-idCard',
        method: 'POST',
        data: data
    })
}
// 改变标识
export function humanAuth(id) {
    return request({
        url: `order/app/${id}/humanAuth`,
        method: 'GET',
    })
}
// 手机号
export function setPhoneNum(data) {
    return request({
        url: `user/app/decryptPhoneNum`,
        method: 'GET',
        data:data
    })
}

// 获取默认收获地址 00
export function getAddress() {
    return request({
        url: 'order/app/latest/address',
        method: 'GET'
    })
}

// 查看推荐
export function saveidCard(data){
    return request({
        url: 'user/app/save-idCard-image',
        method: 'POST',
        data:data
    })
}